<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div id="div1">

</div>

<!--动态获取浏览器高度和宽度-->

<script>
    window.onresize = function(){
        console.log(document.documentElement)

        document.getElementById("div1").innerHTML="宽度："+document.documentElement.clientWidth+"，高度："+document.documentElement.clientHeight;
    }</script>
</body>
</html>